// class类组件
import React, { Component } from 'react'

class Counter extends Component {
    // 1.定义状态变量
    state = {
        count: 0
    }
    // 定义状态更新函数
    setCount = () => {
        this.setState({
            count: this.state.count + 1
        })
    }
    render() {
        return (
            <button onClick={this.setCount}>Counter{this.state.count}</button>
        )
    }
}


const App = () => {
    return (
        <div>
            <Counter />
        </div>
    )
}

export default App
